#include "StdAfx.h"
#include "GameBase.h"
#include "SubStructure.h"
#include "StageImage.h"

StageImage::StageImage()
{
}

StageImage::~StageImage()
{
}

void StageImage::Init()
{
	moveVel = 0;
	Source.top = 3616;
	Source.bottom = 4096;
	Source.left = 0;
	Source.right = 512;
}

void StageImage::Draw()
{
	D3DXMATRIX matrix;
	D3DXMatrixIdentity(&matrix);
	D3DXMatrixTransformation2D(&matrix, 0, 0, 0, 0, 0, &this_pos);

	GameBase::pSprite->SetTransform(&matrix);
	GameBase::pSprite->Draw(Texture,
							&Source,
							NULL,
							NULL,
							0xffffffff);
	D3DXMatrixIdentity(&matrix);
	GameBase::pSprite->SetTransform(&matrix);
}

void StageImage::Update()
{
	if(Source.top > 0){
		Source.top -= moveVel;
		Source.bottom -= moveVel;
	}
}

void StageImage::Reset()
{
	moveVel = 1;
	Source.top = 3616;
	Source.bottom = 4096;
	Source.left = 0;
	Source.right = 512;
}

void StageImage::ForcedMove(DWORD abspos)
{
	Source.top = abspos;
	Source.bottom = abspos + 480;
}

DWORD StageImage::GetTop()
{
	return Source.top;
}

void StageImage::SetVel(DWORD nVel)
{
	moveVel = nVel;
}